package com.antis.olsl.data;

import android.view.View;

import com.alibaba.android.arouter.launcher.ARouter;
import com.antis.olsl.arouterlib.DataRoutePath;
import com.antis.olsl.base.BaseActivity;
import com.antis.olsl.data.databinding.ActivityDataMainBinding;
import com.antis.olsl.library.MyApplication;
import com.antis.olsl.library.bean.UserInfo;

public class DataMainActivity extends BaseActivity<ActivityDataMainBinding> implements View.OnClickListener {

    @Override
    protected ActivityDataMainBinding getViewBinding() {
        return ActivityDataMainBinding.inflate(getLayoutInflater(), baseBinding.getRoot(), true);
    }

    @Override
    protected void initViews() {
        viewBinding.btnPos.setOnClickListener(this);
    }

    @Override
    protected void initData() throws IllegalAccessException {
        if (MyApplication.getUserInfo() == null) {
            UserInfo userInfo = new UserInfo();
            userInfo.setMerchantId("3b138a41030e41e6b89516e9edd95f43");
            userInfo.setUserId("50169");
            userInfo.setPhonenumber("18655009270");
            userInfo.setAvatar("https://ads-mrp-system-bj.oss-cn-beijing.aliyuncs.com/img/fea369d3978c425.jpg");
            MyApplication.setUserInfo(userInfo);
        }
    }

    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.btn_pos) {
            ARouter.getInstance().build(DataRoutePath.ACTIVITY_POS_TURNOVER)
                    .navigation();
        }
    }
}